﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

#region 佛祖保佑
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            佛祖保佑       永无BUG
*/
#endregion

public class Toast : MonoBehaviour
{
    public event EventExtends.StringReturnBool invokeEvent;

    private AndroidJavaObject androidJavaObject;

    private void Awake()
    {
        androidJavaObject = new AndroidJavaObject("com.aoyouzhe.qianfenzhilib.UnityToAndroid");

        invokeEvent += Event;
    }

    public bool InvokeEvent(string content) => invokeEvent(content);

    private bool Event(string content)
    {
        return androidJavaObject.Call<bool>("ShowToast", content);
    }
}
